package cn.scy.util;

import org.mindrot.jbcrypt.BCrypt;

/**
 * 加密工具类
 *
 * @author scy
 */
public final class JbcryptUtils {

    private JbcryptUtils() {
        throw new IllegalStateException("Utility class");
    }

    public static String hashed(String password) {
        return BCrypt.hashpw(password, BCrypt.gensalt());
    }

    public static String hashed(String password, String salt) {
        return BCrypt.hashpw(password, salt);
    }

    public static boolean checkPwd(String password, String hashed) {
        return BCrypt.checkpw(password, hashed);
    }

}
